<?php
/**
 * Created by PhpStorm.
 * User: ycp
 * Date: 2017/4/22
 * Time: 14:39
 */

namespace Home\Controller;


use Think\Controller;

class SearchController extends HomeController
{
    public function index()
    {
        $method = I('get.method');
        if($method =='from'){
            $this->assign('searchName','会籍查询');
        }
        if($method =='booking'){
            $this->assign('searchName','预约记录');
        }
        $this->display();
    }

    /**
     * @name
     * @desc
     * @auther ycp
     */
    public function search()
    {
        $data = I('get.');
        //会籍查询
//        var_dump($data);exit();
        $method = I('get.method');
        if($method == 'from'){
            $memberModel = D('member');
            $data = $memberModel->where([
                'telphone' =>['eq',$data['tel']]
            ])->select();
            $this->assign('data',$data);
            $this->assign('searchData','会籍信息');
            $this->assign('searchName','会籍信息');
            $this->display('index');
        }
        //预约记录
        if($method= 'booking'){
            $yuyueModel = D('Yuyue');
            $data = $yuyueModel->where([
                'yueyu_tel' =>['eq',$data['tel']]
            ])->select();
            $this->assign('data',$data);
            $this->assign('searchData','预约记录');
            $this->assign('searchName','预约记录');
            $this->display('yuyue');
        }
        //证书查询
        if($method= 'certification'){
            $yuyueModel = D('Yuyue');
            $data = $yuyueModel->where([
                'yueyu_tel' =>['eq',$data['tel']]
            ])->select();
            $this->assign('data',$data);
            $this->assign('searchData','证书查询');
            $this->assign('searchName','证书查询');
            $this->display('certification');
        }
        //作品查询
        if($method= 'zuopin'){
            $yuyueModel = D('Yuyue');
            $data = $yuyueModel->where([
                'yueyu_tel' =>['eq',$data['tel']]
            ])->select();
            $this->assign('data',$data);
            $this->assign('searchData','作品查询');
            $this->assign('searchName','作品查询');
            $this->display('zuopin');
        }


    }
}